myApp.controller('zalistController', function ($scope, $uibModal, $stateParams, ngDialog, $http, $filter, $interval, $timeout, $rootScope) {
    $scope.info = {};

    $scope.info.type = 'zone';

    $scope.info.zones = [];
    $scope.info.apps = [];

    $scope.tabClick = function (type) {
        $scope.info.type = type;
        if($scope.info.type == 'zone'){
            $scope.getZone();
        }else if($scope.info.type == 'app'){
            $scope.getApp();
        }
    };

    $scope.getZone = function () {
        $http.get(ucloud_master_url + '/api/v1/zone/', {
            headers: {'Accept': 'application/json'}
        }).success(function (data) {
            $scope.info.zones = data.data;
        });
    };
    $scope.getZone();
    $scope.getApp = function () {
        $http.get(ucloud_master_url + '/api/v1/app/', {
            headers: {'Accept': 'application/json'}
        }).success(function (data) {
            $scope.info.apps = data.data;
        });
    };

    $scope.add = function () {
        window.location.href = '#/menu/addZoneAndApp/';
    }
});